﻿using SaaS.Model.Enums.Systems;
using System;
using System.Collections.Generic;
using System.Text;
using XCore.Redis;

namespace SaaS.Cache.Systems
{
    public class SettingCacheService : CacheServiceBase
    {
        private const string SETTING = "SETTING";
        /// <summary>
        /// 保存配置文件
        /// </summary>
        /// <param name="type"></param>
        /// <param name="value"></param>
        public void SaveSetting(SettingType type, string value)
        {
            string dataKey = type.ToString();
            Redis.HashSetAsync(SETTING, dataKey, value);
        }
        /// <summary>
        /// 获取配置类型值
        /// </summary>
        /// <param name="type"></param>
        /// <returns></returns>
        public string GetSetting(SettingType type)
        {
            return Redis.HashGet(SETTING, type.ToString()).GetRedisValue<string>();
        }
    }
}
